#include "drv_systick.h"
static uint16_t fs_us=0;
static uint16_t fs_ms=0;
void  drv_systick_init(uint8_t systick )
{
  SysTick->CTRL &=~0x05;
  fs_us= systick/8;
  fs_ms= fs_us*1000;
}

void drv_systick_ms(uint16_t ms)
{
  uint32_t temp;
  SysTick->LOAD = fs_ms*ms;
  SysTick->CTRL |=0x01;
  do
  {
		temp= SysTick->CTRL;
  }
	while (!temp&(0x01<<16));
	SysTick->CTRL &=~0x01;
	
}


void drv_systick_us(uint16_t us)
{
	  uint32_t temp;
	  SysTick->LOAD = fs_us*us;
	  SysTick->CTRL |=0x01;
	  do
	  {
			temp= SysTick->CTRL;
	  }
		while (!temp&(0x01<<16));
		SysTick->CTRL &=~0x01;

}
